import { NestFactory } from '@nestjs/core';
import { AdminModule } from './admin.module';
import { ConfigureService } from '@app/configure';

async function bootstrap() {
  console.log('starting.....')
  const app = await NestFactory.create(AdminModule);
  const configure = app.get(ConfigureService)

  const apiPrefix = configure.get('apiPrefix.admin')
  const port = configure.get<string>('httpPort.admin')
  let url = 'http://localhost:' + port


  if(apiPrefix != undefined && apiPrefix.length > 0) {
    url += ('/' + apiPrefix)
    app.setGlobalPrefix(apiPrefix)
  }

  await app.listen(port);
  console.log('url:' + url)
}
bootstrap();